<%--
  Created by IntelliJ IDEA.
  User: 风间琉璃
  Date: 2021/6/23
  Time: 16:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form id="myForm" method="post" action="RentServlet?opr=add">
    <table border="1">
        <tr>
            <h2>添加车位租赁信息</h2>
        </tr>
        <tr>
            <th>租车人姓名（*）</th>
            <td><input type="text" name="userName" id="userName"></td>
        </tr>
        <tr>
            <th>车牌号（*）</th>
            <td>
                <input type="text" name="carNum" id="carNum">
                <span style="display: none">该车辆已租有车位</span>
            </td>
        </tr>
        <tr>
            <th>到期日期（*）</th>
            <td><input type="text" name="maturityDate" id="maturityDate"></td>
        </tr>
        <tr>
            <button type="submit">提交</button>
            <button type="button">返回</button>
        </tr>
    </table>
</form>
<script src="js/jquery-1.8.3.js"></script>
<script>
    $(document).ready(function (){
        $("#myForm").submit(function (){
            var userName = $("#userName").val();
            var carNum = $("#carNum").val();
            var maturityDate = $("#maturityDate").val();
            if (userName.length <= 0 || carNum.length <= 0 || maturityDate.length <= 0){
                alert("请填写完整的车位租赁信息");
                return false;
            }
        })
    })
</script>
</body>
</html>
